package com.un.ebs.sys.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.un.ebs.core.util.SecurityUtils;
import com.un.ebs.sys.domain.ConfigureValue;
import com.un.ebs.sys.dto.ConfigureValueAddDto;
import com.un.ebs.sys.dto.ConfigureValueUpdateDto;
import com.un.ebs.sys.mapper.ConfigureValueMapper;
import com.un.ebs.sys.service.ConfigureValueService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author liubo
 * @since 2019-11-01
 */
@Service
public class ConfigureValueServiceImpl extends ServiceImpl<ConfigureValueMapper, ConfigureValue> implements ConfigureValueService {

    @Override
    public void add(ConfigureValueAddDto req) {
        ConfigureValue obj = new ConfigureValue();
        obj.setValue(req.getValue());
        obj.setConfigureId(req.getConfigureId());
        obj.setIsDelete(false);
        obj.setTenantId(SecurityUtils.getUserContent().getTenantId());
        obj.insert();
    }

    @Override
    public void update(ConfigureValueUpdateDto req) {
        ConfigureValue obj = getById(req.getId());
        obj.setValue(req.getValue());
        obj.setConfigureId(req.getConfigureId());
        obj.updateById();
    }

    @Override
    public ConfigureValue queryById(String id) {
        return getBaseMapper().selectById(id);
    }

    @Override
    public void delete(String id) {
        getBaseMapper().deleteById(id);
    }

}